package com.bush.mall.ware.controller;

import org.springframework.web.bind.annotation.*;
import com.bush.mall.common.entity.Result;;
import com.bush.mall.ware.entity.PurchaseDetailEntity;
import com.bush.mall.ware.service.PurchaseDetailService;
import javax.annotation.Resource;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * 
 * @author RUN
 * @date 2022-11-29
 */
@RestController
@RequestMapping("purchasedetail")
@Api(tags = "管理" )
public class PurchaseDetailController {

    @Resource(name= PurchaseDetailService.BEAN_ID)
    private PurchaseDetailService purchaseDetailService;

    /**
     * 分页查询列表
     * @author RUN
     * @date 2022-11-29
     */
    @ApiOperation(value = "分页查询列表")
    @GetMapping("queryForPage")
    public Result queryForPage(Integer current,Integer size){
        return purchaseDetailService.queryForPage(current,size);
    }

    /**
     * 保存表单
     * @author RUN
     * @date 2022-11-29
     */
    @ApiOperation(value = "保存表单")
    @PostMapping
    public Result savePurchaseDetail(@RequestBody PurchaseDetailEntity purchaseDetail){
        return purchaseDetailService.savePurchaseDetail(purchaseDetail);
    }

    /**
     * 修改表单
     * @author RUN
     * @date 2022-11-29
     */
    @ApiOperation(value = "修改表单")
    @PutMapping
    public Result updatePurchaseDetail(@RequestBody PurchaseDetailEntity purchaseDetail){
        return purchaseDetailService.updatePurchaseDetail(purchaseDetail);
    }

    /**
     * 通过指定id删除
     * @author RUN
     * @date 2022-11-29
     */
    @ApiOperation(value = "通过指定id删除")
    @DeleteMapping
    public Result deletePurchaseDetail(Long id){
        return purchaseDetailService.deletePurchaseDetail(id);
    }

}
